package com.content.management.controller.web;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.content.management.annotation.ResponseResult;
import com.content.management.biz.ClassificationManageService;
import com.content.management.domain.dto.ClassificationAddDto;
import com.content.management.domain.query.ClassificationQuery;
import com.content.management.domain.vo.ClassificationVo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;

/**
 * @author xinghu
 * @version 1.0
 * @date 2020/4/4 5:56 下午
 */
@Api(tags = "分类管理数据接口")
@AllArgsConstructor
@Slf4j
@ResponseResult
@RequestMapping("/011/services/manage/classification")
public class ClassificationManageController {

	private final ClassificationManageService classificationManageService;

	@ApiOperation(value = "分页获取分类管理信息")
	@GetMapping("lists")
	public IPage<ClassificationVo> voPage(ClassificationQuery query) {
		return classificationManageService.voPage(query);
	}


	@ApiOperation(value = "通过id删除所属分类")
	@DeleteMapping("deleteById")
	public boolean deleteById(@RequestParam Long id) {
		return classificationManageService.deleteById(id);
	}


	@ApiOperation(value = "添加或者修改所属分类信息")
	@PostMapping("saveOrUpdateClassification")
	public boolean saveOrUpdateClassification(@RequestBody ClassificationAddDto dto) {
		return classificationManageService.saveOrUpdateClassification(dto);
	}
}
